﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LandNotepad
{
    public class FontConfig
    {
        public static string filePath = "font.txt";//配置信息的路径
        public static Font GetFont()
        {
            Font font = null;

            if (File.Exists(filePath))
            {
                var content = File.ReadAllText(filePath);
                string[] contents = content.Split(',');
                //-------------------------------------------------------
                var ffamily = contents[0];
                var fsize = float.Parse(contents[1]);
                var fstyle = (System.Drawing.FontStyle)Enum.Parse(typeof(System.Drawing.FontStyle), contents[2]);
                //-------------------------------------------------------
                font = new Font(ffamily, fsize, fstyle);
            }

            return font;
        }
    }
}
